/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package dao;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;

/**
 *
 * @author linos
 */
public class NewMain4 {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        BilletDAO billetDAO = new BilletDAO();
        BufferedReader br = null;
        File[] Fichiers = null;

//        File directoryToScan = new File("C:\\Users\\linos\\Desktop\\chaise.csv");
//        Fichiers = directoryToScan.listFiles();
//        System.out.println(Fichiers.length);
        try {
            String sCurrentLine;
            br = new BufferedReader(new FileReader("C:\\Users\\linos\\Desktop\\Cheb_Khaled.csv"));
            int i = 244275; //244194  
            while ((sCurrentLine = br.readLine()) != null) {
                sCurrentLine = sCurrentLine.replaceAll(";", "");
                sCurrentLine = sCurrentLine.toUpperCase();
                 // System.out.println("insert into billet "+sCurrentLine);
                System.out.println("INSERT INTO billet (id, id_tb, utilise, vendu, bnr_acces, numero, id_vente, id_kit, reserve)"
                        + " VALUES (" + i + ",344, false, false, 0, '" + sCurrentLine + "', null, NULL, NULL);");
                i++;
//                if(billetDAO.findLike(sCurrentLine).size()==1)
//                {
//                    //System.out.println(sCurrentLine);
//                      System.out.println("Update billet set vendu=true where numero like '%"+sCurrentLine+"%';");
//                }
////                else
////                    System.out.println("--------------"+sCurrentLine);

            }

        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            try {
                if (br != null) {
                    br.close();
                }
            } catch (IOException ex) {
                ex.printStackTrace();
            }
        }
    }
}
